"""song_taoo URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from niubi.service import v1
from django.shortcuts import HttpResponse, redirect,render
from django.urls import reverse


def index(request):
    test_url = reverse("a1:a2:tst")

    print(test_url)

    return redirect(test_url)


def test(request, *args, **kwargs):
    return HttpResponse("test")

def p1(request):
    return render(request,"p1.html")
from app01 import models
def p2(request):
    if request.method=='GET':
         return render(request,"p2.html")
    elif request.method=='POST':
        obj = models.UserGroup.objects.create(title=request.POST.get("city"))
        return render(request,"p3.html",{"obj":obj})


urlpatterns = [
    # url(r'^admin/', admin.site.urls),
    # url(r'^index/', index),
    # url(r'^test/fdf/fdsd/dsdrfsd/ffsdf',test,name="xxxx"),
    # url(r'^test/(\d+)/fdsd/(\d+)/ffsdf',test,name="xxxx"),
    # url(r'^test/(?P<a1>\d+)/fdsd/(?P<a2>\d+)/ffsdf', test, name="xxxx"),

    # url(r'^app01/', ([
    #                      url(r'^UserInfo/', [(
    #                          url(r'^index/', index, name='idx'),
    #                          url(r'^test/', test, name='tst'),
    #                      ), "a2", "a2"]),
    #
    #                  ], "a1", "a1")),

    url(r'^nb/', v1.site.urls),
    # url(r'^p1/', p1),
    # url(r'^p2/', p2),

]
